package com.bbva.gptf.back.dominio;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import org.springframework.roo.addon.dbre.RooDbManaged;
import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooEntity(identifierType = Tgpt048CargaPK.class, versionField = "", table = "TGPT048_CARGA", schema = "DBSGPT")
@RooDbManaged(automaticallyDelete = true)
public class Tgpt048Carga {

	public static List<Tgpt048Carga> obtieneCargaPorCdFichero(
			final BigDecimal cdFichero) {
		if (cdFichero == null) {
			return new ArrayList<Tgpt048Carga>();
		}
		try {

			final StringBuffer qlString = new StringBuffer(
					"FROM Tgpt048Carga c ");
			qlString.append("WHERE c.cdCarga.cdFichero.cdFichero = :cdFichero ");

			return entityManager()
					.createQuery(qlString.toString(), Tgpt048Carga.class)
					.setParameter("cdFichero", cdFichero).getResultList();

		} catch (final Exception e) {
			// TODO: handle exception
		}

		return new ArrayList<Tgpt048Carga>();
	}
}
